import { createRouter, createWebHistory } from 'vue-router'

// 公共组件
import Home from '/src/views/Home.vue'

// 平台动态
import NewsList from '/src/views/News/List.vue'
import NewsDetail from '/src/views/News/Detail.vue'

// 政策法规
import PolicyList from '/src/views/Policy/List.vue'
import PolicyDetail from '/src/views/Policy/Detail.vue'

// 违规投诉
import ComplaintList from '/src/views/Complaint/List.vue'
import ComplaintDetail from '/src/views/Complaint/Detail.vue'
import ComplaintCreate from '/src/views/Complaint/Create.vue'

// 信息公告
import AnnouncementList from '/src/views/Announcement/List.vue'
import AnnouncementDetail from '/src/views/Announcement/Detail.vue'

// 个人中心
import UserCenter from '/src/views/User/Center.vue'
import CompanyInfo from '/src/views/User/Company.vue'
import BiddingInfo from '/src/views/User/Bidding.vue'
import MyBids from '/src/views/User/MyBids.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  // 平台动态
  {
    path: '/news',
    name: 'NewsList',
    component: NewsList
  },
  {
    path: '/news/:id',
    name: 'NewsDetail',
    component: NewsDetail,
    props: true
  },
  // 政策法规
  {
    path: '/policy',
    name: 'PolicyList',
    component: PolicyList
  },
  {
    path: '/policy/:id',
    name: 'PolicyDetail',
    component: PolicyDetail,
    props: true
  },
  // 违规投诉
  {
    path: '/complaint',
    name: 'ComplaintList',
    component: ComplaintList
  },
  {
    path: '/complaint/:id',
    name: 'ComplaintDetail',
    component: ComplaintDetail,
    props: true
  },
  {
    path: '/complaint/create',
    name: 'ComplaintCreate',
    component: ComplaintCreate
  },
  // 信息公告
  {
  path: '/announcement',
  children: [
    {
      path: 'list',
      component: AnnouncementList
    },
    {
      path: 'detail/:id',
      component: AnnouncementDetail,
      props: true
    }
  ]
},
  // 个人中心
  {
    path: '/user/center',
    name: 'UserCenter',
    component: UserCenter,
    children: [
      {
        path: 'company',
        name: 'CompanyInfo',
        component: CompanyInfo,
        meta: {
        breadcrumb: '企业信息' // 添加面包屑元信息
      }
      },
      {
        path: 'bidding',
        name: 'BiddingInfo',
        component: BiddingInfo,
        meta: {
        breadcrumb: '参与投标' // 添加面包屑元信息
      }
      },
      {
        path: 'mybids',
        name: 'MyBids',
        component: MyBids,
        meta: {
        breadcrumb: '我的投标' // 添加面包屑元信息
      }
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router